package com.wk.kxexamadminister.controller;

import com.wk.kxexamadminister.entity.ManyChoice;
import com.wk.kxexamadminister.mapper.ManyChoiceMapper;

import com.wk.kxexamadminister.utils.uploadUtils;
import io.swagger.annotations.Api;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import sun.text.normalizer.IntTrie;
import sun.text.normalizer.Trie;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

@Api(description = "多选")
@Controller
public class ManyChoiceController {

    @Autowired
    private ManyChoiceMapper manyChoiceMapper;

    @PostMapping("addManyChoice")
    @ResponseBody
    public String addManyChoice(ManyChoice manyChoice){
        int insert = manyChoiceMapper.insert(manyChoice);
        if(insert == 1){
            return "Success";
        }else {
            return "Failure";
        }
    }


    @GetMapping("findManyChoice")
    @ResponseBody
    public List<ManyChoice> findManyChoice(){
        List<ManyChoice> manyChoices = manyChoiceMapper.selectList(null);
        for (ManyChoice manyChoice : manyChoices) {
            String description = manyChoice.getDescription();
            String[] split = description.split(",");
            System.out.println(split[0]);
        }
        return manyChoices;
    }




}
